persist credentials retrieved through the wizard
authorJyrki Gadinger <nilsding@nilsding.org>
Fri, 17 Jan 2025 13:28:11 +0000 (14:28 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Fri, 24 Jan 2025 14:07:16 +0000 (15:07 +0100)
When setting up an account through the wizard for the first time, the
credentials are not saved properly.  This requires the user to sign in
again after an application restart.

At least for the login flow v2 case, the `WebFlowCredentials` class
eventually persists the retrieved credentials, whereas the class used
within the wizard (`OCC::Flow2AuthCredsPage`) doesn't.

Signed-off-by: Jyrki Gadinger <nilsding@nilsding.org>
src/gui/creds/webflowcredentials.cpp
src/gui/owncloudsetupwizard.cpp

index 0495d3b888a2e01635923588ddd2a63ba33c50a1..bd2eb458eb07c37690407af986d53859496d1be0 100644 (file)
@@ -213,6 +213,7 @@ bool WebFlowCredentials::stillValid(QNetworkReply *reply) {
 void WebFlowCredentials::persist() {
     if (_user.isEmpty()) {
         // We don't even have a user nothing to see here move along
+        qCWarning(lcWebFlowCredentials) << "_user is unset, nothing to persist ...";
         return;
     }
 
index 58a6d613f047512ec184e9a85604032d29540fda..6b36e0fe7e4780af5fece3c783c92a80580e7fc8 100644 (file)
@@ -339,6 +339,7 @@ void OwncloudSetupWizard::slotConnectToOCUrl(const QString &url)
     AbstractCredentials *creds = _ocWizard->getCredentials();
     if (creds) {
         _ocWizard->account()->setCredentials(creds);
+        creds->persist();
     }
 
     const auto fetchUserNameJob = new JsonApiJob(_ocWizard->account()->sharedFromThis(), QStringLiteral("/ocs/v1.php/cloud/user"));